/**
 * Copyright (C), 2019-2020, 宇信融汇
 * FileName: Dog
 * Author:   xbliu
 * Date:     2020/6/18 14:31
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * xbliu           修改时间           版本号              描述
 */
package c_003;

/**
 * @Classname Dog
 * @Description 封装
 * @Date 2020/6/18 14:31
 * @Created by xbliu
 */
public class Dog {
    String name;
    private int age;
    String clolor;

    public Dog() {
        System.out.println("dog无参的构造方法");
    }

    public Dog(String name, int age, String clolor) {
        this.name = name;
        this.age = age;
        this.clolor = clolor;
    }

    public Dog(int age) {
        if (age > 0) {
            this.age = age;
        } else {
            System.out.println("年龄格式存在问题");
        }
    }

    public void setAge(int age) {
        if (age > 0) {
            this.age = age;
        } else {
            System.out.println("年龄格式存在问题");
        }
    }

    public void show() {
        System.out.println("name【"+name+"】");
        System.out.println("age【"+age+"】");
        System.out.println("clolor【"+clolor+"】");
    }
}
